package com.mezz.bones.im.logic.process.impl;

import com.mezz.bones.im.common.enums.ActionCodeEnum;
import com.mezz.bones.im.common.message.base.MessageHeader;
import com.mezz.bones.im.common.message.body.in.ConversationRecordReq;
import com.mezz.bones.im.common.message.body.out.ConversationRecordRes;
import com.mezz.bones.im.common.domain.user.ImUserConnectInfo;
import com.mezz.bones.im.logic.process.interfaces.AbstractMessageLogicProcess;
import com.mezz.bones.im.logic.service.IChatConversationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author: zhuang
 * @Date: 2024/11/29 18:39
 * @Description: TODO
 * @Version: 1.0
 **/

@Service
public class ConversationRecordProcess extends AbstractMessageLogicProcess<ConversationRecordReq, List<ConversationRecordRes>> {

    @Resource
    private IChatConversationService conversationService;

    @Override
    public void preHandlerParam(ImUserConnectInfo senderUserConnectInfo, MessageHeader header, ConversationRecordReq req) {
        req.setUserId(senderUserConnectInfo.getUserId());
    }

    @Override
    public String tag() {
        return ActionCodeEnum.CLIENT_CONVERSATION_RECORD.getCode();
    }

    @Override
    public List<ConversationRecordRes> process(ImUserConnectInfo senderUserConnectInfo, MessageHeader header, ConversationRecordReq req, Map<String, Object> ctx) {
        return conversationService.getUserConversationRecord(req);
    }
}
